/*
 * 软件版权:
 * 修改记录:
 * 修改日期     修改人员  修改说明
 * ========    =======  ============================================
 * 2020/8/10  lsy13  新增
 * ========    =======  ============================================
 */
package com.sansi.pencilbook.util;

import org.springframework.util.ResourceUtils;

import java.io.FileNotFoundException;

/**
 * 功能说明:
 *
 * @author lsy13
 */
public class PathUtil {
  public static String getImagesPath() {
    String path = null;
    try {
      String serverpath= ResourceUtils.getURL("classpath:static\\images").getPath()
          .replace("%20"," ")
          .replace('/', '\\')
          .replace("%5c","\\");
      path=serverpath.substring(1);//从路径字符串中取出工程路径
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    return path;
  }

  public static String getExcelPath() {
    String path = null;
    try {
      String serverpath= ResourceUtils.getURL("classpath:static\\excel").getPath()
          .replace("%20"," ")
          .replace('/', '\\')
          .replace("%5c","\\");
      path=serverpath.substring(1);//从路径字符串中取出工程路径
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    return path;
  }
}
